{{#extends @feed.html}}
<!--
    lucky@jetstyle.ru о шаблонных переменных:

    member - владелец этой странички
    user   - пользователь, просмаривающий эту страницу
-->

{{:title}}Записи пользователя{{/:title}}

<!-- действия -->
{{:init}}
	{{@feed.html:init}}
	{{!connect "screen/member.css" media="screen" charset="utf-8"}}
{{/:init}}

{{:body}}
<!-- ========================= Установки для работы js ============== -->
<!-- для imageswitcher.js -->
{{@html/config/imageswitcher.html}}

<a href="{{ajax_url}}" id="feed_url"></a>
<a href="{{items_remaining}}" id="items_remaining"></a>
<!-- ========================= Установки для работы js ============== -->

	<div class="community-head">
		<div style="background: #000 url({{@:community_bg_url}});">
			{{@html/common/servicebar.html}}
		</div>
		{{@html/widgets/top_menu.html}}
	</div>
	<div class="layout-standard">
		<div class="layout-c-right">
			{{tags}}
			{{?tdis}}
			{{!connect "screen/widgets/wg-selector-user.css"}}
			<div id="tdis_container" class="widget wg-selector-user">
				<h2 class="title-">Разделы записей</h2>
				<form action="" method="get" id="tdi_form">
				<ul class="list-">
				{{!for tdis do=@:tdis_community}}{{:tdis_community}}
					<li class="item-">
						<input type="checkbox" id="community{{*community.oid}}" onclick="toggleChilds('{{*community.oid}}');" name="c{{*community.oid}}" value="1"{{?!*unchecked}} checked="checked"{{/?}} /> <label for="community{{*community.oid}}">{{*community.title}}</label> {{*count}}
						{{?*items}}
						<ul class="sublist-">
							{{!for *items do=@:tdis}}
							{{:tdis}}
							<li class="subitem-">
								{{?*section}}
								<input type="checkbox" class="community{{*community_oid}}tdi" onclick="testCheckParent(this, '{{*community_oid}}');" name="c{{*community_oid}}tdi{{*section}}" id="c{{*community_oid}}tdi{{*section}}" value="1"{{?!*unchecked}} checked="checked"{{/?}} /> <label for="c{{*community_oid}}tdi{{*section}}">{{*item.title}}</label>
								{{?:}}
								<input type="checkbox" class="community{{*community_oid}}tdi" onclick="testCheckParent(this, '{{*community_oid}}');" name="c{{*community_oid}}tdi0" id="c{{*community_oid}}tdi0" value="1"{{?!*unchecked}} checked="checked"{{/?}} /> <label for="c{{*community_oid}}tdi0">без раздела</label>
								{{/?}}
								{{*count}}
							</li>
							{{/:tdis}}
						</ul>
						{{/?}}
					</li>
				{{/:tdis_community}}
				</ul>
				<input type="image" src="{{images}}button-show.gif" alt="Показать" class="submit-" />
			</form>
		</div>
		<script type="text/javascript">
			function toggleChilds( oid ) {
				var groupName = "input.community" + oid + "tdi";
				var checked = jQuery("#community" + oid).get(0).checked;
				jQuery("#tdis_container").find(groupName).each(function(){
 					this.checked = checked;
  				});
			}

			function testCheckParent( childItem, parentOID ) {
				var setCheck = childItem.checked;
				var groupName = "input.community" + parentOID + "tdi";
				if ( setCheck ) {
					jQuery("#community" + parentOID).get(0).checked = true;
				} else {
					var needClean = true;
					jQuery("#tdis_container").find(groupName).each(function(){
						if ( this.checked ) {
							needClean = false;
						}
					});
					if ( needClean ) {
						jQuery("#community" + parentOID).get(0).checked = false;
					}
				}
			}
		</script>
		{{/?}}

		</div>
		<div class="layout-c-main content-posts"><div class="contenthandler">
			<!-- avatar -->
			<div class="user-avatar"><a href="{{?community.url}}{{/}}{{community.url}}/members/{{member.oid}}{{?:}}{{/}}members/{{member.oid}}{{/?}}"><img src="{{?member.avatar}}{{/}}{{member.avatar | link_to 'imagestorage' 'orig'}}{{?:}}{{images}}avatar-100x100.png{{/?}}" /></a></div>
			<!-- status -->
			<!-- content -->
			<div class="user-info">
				<h1 class="title-">
					Записи пользователя {{member.fullname}}{{?member.nick}} aka {{member.nick}}{{/?}}
					{{?tag_sections.selected}}
					<!-- раздел, раздел => тег -->
					{{?current_tag}} по теме &laquo;{{current_tag.name}}&raquo; {{/?}}
					{{?:tdi_title}}
					<!-- разделы не выбраны -->
					<!-- тег -->
					{{tdi_title}}
					{{/?}}
				</h1>
				{{?member.status}}<div class="status-"><strong>Настроение:</strong> {{member.status}}</div>{{/?}}
				<!-- about -->
				{{?member.description}}
				<div class="desc- content">
					<strong>О пользователе:</strong>
					<span id="member-description-edit">{{member.description|safe}}</span>
				</div>
				{{/?}}
			</div>
			<!-- persons -->
			{{?member.persons}}
			<ul>
			{{!for member.persons do=@:person}}
			{{:person}}
				<li>Он же: <a href="{{*url}}">{{*fullname}}</a></li>
			{{/:person}}
			</ul>
			{{/?}}

			<div class="list-" id="itemslist">
				{{@:itemslist}}
				{{:itemslist}}
				{{!for items do=@:blogitemblock}}
				{{/:itemslist}}
			</div>
			</div>
		{{@feed.html:layout_pager}}
		</div>
	</div>

{{/:body}}

{{:blogitemblock}}
<div class="item- js-post" id="i{{*post.oid}}">
	<!-- issue -->
	{{@:feed_item type=*post.type}}
	{{?*tags}}
	<ul class="tags-">
		<li class="hdr-">Тематика записи:</li>
		{{!for *tags do=@:tag}}
		{{:tag *is_current}}<li>{{*title}}{{?!For.last}},{{/?}}</li>{{/:tag}}
		{{:tag}}<li><a href="?tag={{*title|escape type='url'}}" title="Выбрать все записи с меткой &laquo;{{*title}}&raquo;">{{*title}}</a>{{?!For.last}},{{/?}}</li>{{/:tag}}
	</ul>
	{{/?}}

	<!-- блок комментов (добавьте во внешний тег class="js-post" и id="i{{post_oid}}") -->
	{{@html/comments/comments.html:main item=* community=*community}}
</div>
{{/:blogitemblock}}

{{:feed_item}}
{{?type=='fdoc'}} {{@:doc}} {{/?}}
{{?type=='fquest'}} {{@:quest}} {{/?}}
{{?type=='fimage'}} {{@:image}} {{/?}}
{{?type=='flink'}} {{@:link}} {{/?}}
{{?type=='ffile'}} {{@:file}} {{/?}}
{{?type=='fissue'}} {{@:issue}} {{/?}}
{{?type=='freview'}} {{@:review}} {{/?}}
{{?type=='fvote'}} {{@:vote}} {{/?}}
{{/:feed_item}}

{{:userbarpost}}
<ul class="userbar-">
	<li class="date-">{{*post.ctime|date "%d %M %Y, в %H:%i"}}</li>
	{{?*issue.issue_number}}<li>Опубликовано в <a href="{{/}}{{*post.community_url}}/{{*post.issue_oid}}/showissue">{{*issue.issue_number}}. {{*issue.issue_name}} ({{*issue.tdi_title}})</a></li>{{/?}}
	{{?*acl.item_edit.is_allowed}}
	<li class="edit-"><a href="{{/}}{{*post.community_url}}/{{*post.oid}}/edititem">Редактировать</a></li>
	{{/?}}
	{{?*acl.item_delete}}
	<li class="delete-"><a href="{{/}}{{*post.community_url}}/{{*post.oid}}/deleteitem">Удалить</a></li>
	{{/?}}
</ul>
{{/:userbarpost}}

{{:doc}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@:userbarpost}}
{{/:doc}}

{{:quest}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@:userbarpost}}
{{/:quest}}

{{:image}}
{{!min *image.sm1_size_x *image.sm2_size_x *image.orig_size_x}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@feed.html:userbarpost}}
{{@html/doctypes/feed/image.html:gal_bar}}
<div class="content- content">
	<!-- Эта штука указывает imageswitcher.js выбранный тип после загрузки страницы -->
	<a href="sm2" class="default-image-type"></a>

	<a href="{{/}}{{*post.image_oid | link_to 'imagestorage'}}" class="bn" target="_blank">
		{{?*image.path_to_sm2}}
		<img src="{{/}}{{*post.image_oid | link_to 'imagestorage' 'sm2'}}" alt="" class="bn js_image-container" id="img-{{*post.image_oid}}" />
		{{?:}}
		<img src="{{/}}{{*post.image_oid | link_to 'imagestorage'}}" alt="" class="bn js_image-container" id="img-{{*post.image_oid}}" />
		{{/?}}
	</a>
	<p>{{*post.description | safe}}</p>
</div>
{{/:image}}

{{:link}}
<!-- Ссылки -->
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@:userbarpost}}
<div class="content- content">
	<p><a href="{{*post.url}}" class="url-">{{*post.url}}</a> — {{*post.description | safe}}</p>
</div>
{{/:link}}

{{:file}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@feed.html:userbarpost}}
<div class="content- content linkheader- type-{{*file.extension}}-">
	<!--  size=*file.file_size}} -->
	<p><span class="url-"><a href="{{/}}filestorage/{{*post.file_oid}}">{{*file.real_fname}}</a> &nbsp;{{*file.file_size|formatfilesize}}</span> — {{*post.description | safe}}</p>
</div>
{{/:file}}

{{:issue}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}/showissue">{{*post.issue_number}}. {{*post.issue_name}}</a></h2>
{{@feed.html:userbarpost}}
<div class="content- content">
<p>{{*post.issue_descr | safe}}</p>
</div>
{{/:issue}}

{{:review}}
<h2 class="header-">{{?*community.title}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a></h2>
{{@:userbarpost}}
<div class="content- content"><p>
	{{?item_oid}}
	{{*post.body | safe}}
	{{?:}}
	{{*post.announce | safe}}
	{{/?}}</p>
	<dl>
		<dt>Название предмета рецензии:</dt>             <dd>{{*post.subject}}</dd>
		<dt>Авторы предмета рецензии:</dt>               <dd>{{*post.authors}}</dd>
		<dt>Адрес ссылки на предмет рецензии (URL):</dt> <dd>{{*post.url}}</dd>
		<dt>Краткое описание предмета рецензии:</dt>     <dd>{{*post.description | safe}}</dd>
		<dt>ISDN:</dt>                                   <dd>{{*post.isdn}}</dd>
	</dl>
</div>
{{/:review}}

{{:vote}}
<h2 class="header-">
	{{?*community}}<a href="{{/}}{{*post.community_url}}">{{*community.title}}</a> &rarr; {{/?}}
	<a href="{{/}}{{*post.community_url}}/{{*post.oid}}">{{*post.title}}</a>
</h2>

<div class="content- content doctype-vote-content">
	<p>{{*post.question}}</p>
	{{?*already_voted || !*can_vote}}
	<p>Проголосовал <strong>{{*post.overall_voters}}</strong> {{!splural *post.overall_voters "человек" "" "а" "" sep=" "}}.{{?*vote_closed}} Голосование закрыто.{{/?}}</p>
	{{/?}}
</div>
{{?*already_voted || !*can_vote}}
<div class="doctype-vote-answers">
{{!for *post.answers do=@:answer}}{{:answer}}
	<div class="answer-">
		<div class="bar-"><div class="barscale-" style="width: {{!eval (*voters * 100 / *post.max_voters) }}px;"></div></div>
		{{*text}} <span class="count-">— {{*voters}}</span>
	</div>
{{/:answer}}
</div>
{{?:!*vote_closed && *can_vote}}
{{@:vote_form}}{{:vote_form}}
<div class="doctype-vote-form"><div class="bg1-"><div class="bg2-"><div class="bg3-">
	<p class="subtitle-">А как думаете вы?</p>
	<form action="{{*vote_url|safe}}" method="POST">
		<div class="vlist-">
		{{!for *post.answers as='variant' do=@:answer_form}}{{:answer_form}}
			<fieldset class="vitem-"><input type="radio" value="{{variant.num}}" name="vote_variant" id="{{*post.oid}}-{{variant.num}}"/> <label for="{{*post.oid}}-{{variant.num}}">{{variant.text}}</label></fieldset>
		{{/:answer_form}}
		</div>
		<ul class="buttons-">
			<li class="accept-"><span class="bg1-"><input type="submit" name="vote_button" value="Голосовать" class="submit-" /></span></li>
			{{?*can_close}}
			<li class="neutral-"><span class="bg1-"><input type="submit" name="vote_close_button" value="Завершить" class="submit-" /></span></li>
			{{/?}}
		</ul>
	</form>
</div></div></div></div>
{{/:vote_form}}
{{/?}}
{{/:vote}}
